home *** CD-ROM | disk | FTP | other *** search
- /* *********************************************************************************
-
- MODULE: UserInfo Module
-
- DESCRIPTION: This UserInfo Module is a simple module for MUBBS, the
- Multi-User Bulliten Board System Software.
-
- AUTHOR: Noam Freedman
-
- Copyright © 1990 by Noam Freedman. Portions are also Copyright Symantec Corp.
-
- This program source code and it's compiled version IS NOT IN THE
- PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NMF" file for details
- regarding use of this program source code and it's compiled version.
-
- Revision History:
- ============================================================
- 11/10/91 - Started programming
- 11/10/91 - Edited for release
- ============================================================
-
-
- ******************************************************************************** */
-
- #define INMAIN
-
-
- #include "MUBBS Module.h"
- #include <SetUpA4.h>
-
- typedef struct PPP {
- char passstring[260]; /* the string to pass to the module */
- int field; /* the field to get */
- int uerror; /* any errors found ? */
- };
-
- pascal void main (mode1,G1,P1)
- int mode1;
- struct GS *G1;
- Ptr P1; /* We aren't using this here */
- {
- Handle temph;
- float version = 0.5; /* what version of MUBBS you are compatable with IE: .5 and above */
- RememberA0(); SetUpA4(); /* This sets up the A4 register to access our globals */
- asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* locks our module, do this ! */
-
- G=G1; /* This MUST be the first thing you do in main only, it sets up the struct globals */
- mode[u]=mode1; /* set up our mode so that you can read it anywhere */
-
-
- switch (mode[u]) { /* any un-handled modes return error from this module */
- case 2:
- dostuff();
- G->moduleresult=0;
- break;
- case 98:
- versionck(version); /* just return after this call, don't modify anything */
- break;
- case 0:
- strcpy (G->programmer,"Noam Freedman"); /* show the programmer's name up to 20 chars*/
- G->moduleresult=0; /* this was also a init call if we need close call put 99 here */
- break;
- default:
- G->moduleresult=1; /* return bad code */
- };
-
- HUnlock(temph); /* unlocks this module, do this ! */
- RestoreA4(); /* call this when you are all done */
- }
-
- checktime(warned) /* check if they are out of time yet */
- int warned;
- {
-
- if(G->timeon[u] >= G->timeallowed[u]) {
- send("]]YOUR TIME HAS EXPIRED, PLEASE CALL BACK TOMMOROW..]");
- G->online[u]=FALSE; /* log them off now ! */
- return TRUE;
- }
- if(!warned && (G->timeon[u]+5) >= G->timeallowed[u]) {
- send("]LOGOFF WARNING, YOU HAVE 5 MINUTES OF TIME LEFT !]");
- return TRUE;
- }
- return FALSE;
- }
-
-
- dostuff()
- {
-
- struct PPP P;
- int i, warned;
- char pass[40],
- address[40],
- city[40],
- phone[40],
- machine[40],
- firston[40],
- set1[40],
- set2[40],
- set3[40],
- set4[40],
- set5[40],
- set6[40],
- times[40],
- minslast[40],
- ups[40],
- downs[40],
- temp[40],
- temp1[40],
- temp2[40],
- tempextra[40],
- ch;
-
-
- if (!G->online[u]) { return; } /* do this check so we can log out if hang up */
-
- loguser(G->modulename[u]); /* this tells where you are for remote sysop, or writes to log file */
-
- /* you print the following so that the sysop can monitor use on the mac screen */
-
- print("C> Line %d %s, at: %s\n",(u+1),G->username[u],G->modulename[u]);
-
- send(G->CR[u]);
-
-
-
- P.field = 3; /* (users password) */
- module(3,"getuserfield",&P);
- strcpy(pass,P.passstring); /* move it so we can work with it */
- removespaces(pass); /* takes out trailing spaces */
-
- P.field = 5; /* (users address) */
- module(3,"getuserfield",&P);
- strcpy(address,P.passstring); /* move it so we can work with it */
- removespaces(address); /* takes out trailing spaces */
-
- P.field = 6; /* (users city) */
- module(3,"getuserfield",&P);
- strcpy(city,P.passstring); /* move it so we can work with it */
- removespaces(city); /* takes out trailing spaces */
-
- P.field = 7; /* (users phone) */
- module(3,"getuserfield",&P);
- strcpy(phone,P.passstring); /* move it so we can work with it */
- removespaces(phone); /* takes out trailing spaces */
-
- P.field = 8; /* (users machine) */
- module(3,"getuserfield",&P);
- strcpy(machine,P.passstring); /* move it so we can work with it */
- removespaces(machine); /* takes out trailing spaces */
-
- P.field = 9; /* (users firstlogon) */
- module(3,"getuserfield",&P);
- strcpy(firston,P.passstring); /* move it so we can work with it */
- removespaces(firston); /* takes out trailing spaces */
-
- P.field = 10; /* (users settings) */
- module(3,"getuserfield",&P);
- strcpy(temp,P.passstring); /* move it so we can work with it */
- removespaces(temp); /* takes out trailing spaces */
- sscanf(temp,"%[^,],%[^,],%[^,],%[^,],%[^,],%s",
- set1,set2,set3,set4,set5,set6);
-
- P.field = 14; /* (users timeson) */
- module(3,"getuserfield",&P);
- strcpy(times,P.passstring); /* move it so we can work with it */
- removespaces(times); /* takes out trailing spaces */
-
- P.field = 16; /* (users timeonlastlogon) */
- module(3,"getuserfield",&P);
- strcpy(temp,P.passstring); /* move it so we can work with it */
- removespaces(temp); /* takes out trailing spaces */
- sscanf(temp,"%[^,],%s",minslast,tempextra);
-
- P.field = 17; /* (users up/down count) */
- module(3,"getuserfield",&P);
- strcpy(temp,P.passstring); /* move it so we can work with it */
- removespaces(temp); /* takes out trailing spaces */
- sscanf(temp,"%[^,],%[^,],%s",ups,downs,tempextra);
-
-
- displayinfo:
-
- send("]]%s's Information]",G->username[u]);
- for( i = 1 ; i <= (strlen(G->username[u]) + 14);i++) send("-");
- send(G->CR[u]);
- send(G->CR[u]);
-
- send("Name : %-28s Accesslevel : %i]",G->username[u],G->userpriv[u]);
- send("First on : %-28s Last on : %s]",firston,G->userlast[u]);
- send("Times on : %-28s Time on last : %s]",times,minslast);
- send("Uploads : %-28s Downloads : %s]]",ups,downs);
-
- send(" (you can change any item below)]]");
-
- send("Password : %s]","<--- PRIVATE --->");
- send("Address : %s]",address);
- send("City, State, Zip : %s]",city);
- send("Telephone number : %s]",phone);
- send("Machine Type : %s]",machine);
- send(G->CR[u]);
-
- if(strcmp(set1,"0")==0) strcpy(temp,"NO LIMIT");
- else strcpy(temp,set1);
- send("Number of lines per screen : %s]",temp);
-
- if(strcmp(set2,"1")==0) strcpy(temp,"ON");
- else if(strcmp(set2,"0")==0) strcpy(temp,"OFF");
- else strcpy(temp,set2);
- send("Flag: privacy : %s]",temp);
-
- if(strcmp(set3,"0")==0) strcpy(temp,"ASCII");
- else if(strcmp(set3,"1")==0) strcpy(temp,"ANSI");
- else strcpy(temp,set3);
- send("Language : %s]",temp);
-
- send("]>> (select a first letter from above), Quit : ");
-
- if (!(cmd1(""))) {G->online[u]=FALSE; goto byebye;}
- warned=checktime(warned);
- if (!G->online[u]) goto byebye;
- ch = G->input[u];
- send(G->CR[u]);
- switch (ch)
- {
- case 'P':
- send("]]Enter your current password (Stars echo) : ");
- passportsin(temp,30);
- send(G->CR[u]);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- strtoupper(temp); /* uppercase the password */
- if( strcmp(temp,pass) != 0 ) {send("]]Incorrect!!]]");goto displayinfo;break;}
- send("]You will now be asked for your new password, and then you must verify it.]]");
- send("]]Enter your new password (Stars echo) : ");
- passportsin(temp,29);
- send(G->CR[u]);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- strtoupper(temp); /* uppercase the password */
- send("]]Enter your new password again (stars echo) : ");
- passportsin(tempextra,29);
- send(G->CR[u]);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- strtoupper(tempextra); /* uppercase the password */
- if( strcmp(temp,tempextra) != 0) {send("]]The two passwords do not match.]]");goto displayinfo;break;}
- if (strlen(temp) < 4) {send("]]Your password must be between 4 and 30 characters.]]");
- goto displayinfo;break;}
-
- P.field = 3; /* (users address) */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- module(3,"putuserfield",&P);
- P.field = 3;
- module(3,"getuserfield",&P);
- strcpy(pass,P.passstring); /* move it so we can work with it */
- removespaces(pass); /* takes out trailing spaces */
-
- goto displayinfo;
- break;
-
- case 'A':
- send("]]Your address is currently set to: %s]",address);
- {
- send("]]Enter your address: ");
- portsin(temp, 30);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- send("]You typed in: \"%s\", is this correct (Y,N)? ",temp);
- if (!(cmd1(""))) {goto displayinfo;break;}
- ch = G->input[u];
- if ( ch != 'Y' && ch != 'y') {goto displayinfo;break;}
- P.field = 5; /* (users address) */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- module(3,"putuserfield",&P);
- P.field = 5;
- module(3,"getuserfield",&P);
- strcpy(address,P.passstring); /* move it so we can work with it */
- removespaces(address); /* takes out trailing spaces */
- }
- goto displayinfo;
- break;
- case 'C':
- send("]]Your City, State, Zip is currently set to: %s]",city);
- {
- send("]]Enter your City, State, Zip: ");
- portsin(temp, 30);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- send("]You typed in: \"%s\", is this correct (Y,N)? ",temp);
- if (!(cmd1(""))) {goto displayinfo;break;}
- ch = G->input[u];
- if ( ch != 'Y' && ch != 'y') {goto displayinfo;break;}
- P.field = 6; /* (users city) */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- module(3,"putuserfield",&P);
- P.field = 6;
- module(3,"getuserfield",&P);
- strcpy(city,P.passstring); /* move it so we can work with it */
- removespaces(city); /* takes out trailing spaces */
- }
- goto displayinfo;
- break;
- case 'T':
- send("]]Your phone number is currently set to: %s]",phone);
- {
- send("]]Enter your phone number: ");
- portsin(temp, 30);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- send("]You typed in: \"%s\", is this correct (Y,N)? ",temp);
- if (!(cmd1(""))) {goto displayinfo;break;}
- ch = G->input[u];
- if ( ch != 'Y' && ch != 'y') {goto displayinfo;break;}
- P.field = 7; /* (users phone) */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- module(3,"putuserfield",&P);
- P.field = 7;
- module(3,"getuserfield",&P);
- strcpy(phone,P.passstring); /* move it so we can work with it */
- removespaces(phone); /* takes out trailing spaces */
- }
- goto displayinfo;
- break;
-
- case 'M':
- send("]]Your computer is currently set to: %s]",machine);
- {
- send("]]Enter your type of computer: ");
- portsin(temp, 30);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- send("]You typed in: \"%s\", is this correct (Y,N)? ",temp);
- if (!(cmd1(""))) {goto displayinfo;break;}
- ch = G->input[u];
- if ( ch != 'Y' && ch != 'y') {goto displayinfo;break;}
- P.field = 8; /* (users computer) */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- module(3,"putuserfield",&P);
- P.field = 8;
- module(3,"getuserfield",&P);
- strcpy(machine,P.passstring); /* move it so we can work with it */
- removespaces(machine); /* takes out trailing spaces */
- }
- goto displayinfo;
- break;
- case 'N':
- send("]]Your current number of lines per screen is: %s]]",set1);
- send("To have MUBBS never pause, enter 0 for your choice.]");
- {
- send("]]Enter your choice : ");
- portsin(temp, 3);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- i=strtoint(temp);
- if(i<=-1) {send("]]Incorrect choice.]]");goto displayinfo;break;}
- inttostr(i,set1);
- }
- sprintf(temp,"%s,%s,%s,%s,%s,%s",set1,set2,set3,set4,set5,set6); /* Prepare the user name for compare */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- P.field = 10;
- module (3,"putuserfield",&P); /* int mode & module's name & pointer to the P struct */
- G->userlines[u]= i;
- goto displayinfo;
- break;
-
- case 'F':
- send("]]Privacy: [0%c Off [1%c On]]",']',']');
- send("Your current setting is: %s]]",set2);
- {
- send("]]Enter your choice : ");
- portsin(temp, 1);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if (strcmp(temp,"")==0) {goto displayinfo;break;}
- if(temp[0] < '0') {send("]]Incorrect choice.]]");goto displayinfo;break;}
- if(temp[0] > '1') {send("]]Incorrect choice.]]");goto displayinfo;break;}
- strcpy(set2,temp);
- }
- sprintf(temp,"%s,%s,%s,%s,%s,%s",set1,set2,set3,set4,set5,set6); /* Prepare the user name for compare */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- P.field = 10;
- module (3,"putuserfield",&P); /* int mode & module's name & pointer to the P struct */
- G->privacy[u]=strtoint(set2);
- goto displayinfo;
- break;
-
- case 'L':
- send("]]Language: [0%c ASCII [1%c ANSI]]",']',']');
- send("Your current setting is: %s]]",set3);
- {
- send("]]Enter your choice : ");
- portsin(temp, 1);
- if (! G->online[u]) goto byebye; /* portsin returns online for a time out */
- /* always check for online before continuing */
- if(temp[0] < '0') {send("]]Incorrect choice.]]");goto displayinfo;break;}
- if(temp[0] > '1') {send("]]Incorrect choice.]]");goto displayinfo;break;}
- strcpy(set3,temp);
- }
- sprintf(temp,"%s,%s,%s,%s,%s,%s",set1,set2,set3,set4,set5,set6); /* Prepare the user name for compare */
- sprintf(P.passstring,"%-30s~\n",temp); /* make sure it's the correct length !! */
- P.field = 10;
- module (3,"putuserfield",&P); /* int mode & module's name & pointer to the P struct */
- G->language[u]=strtoint(set3);
- goto displayinfo;
- break;
- case 'Q':
- goto byebye;
- break;
- default:
- goto displayinfo;
- break;
- }
-
-
-
-
-
- byebye:
- P.field=0;
- return;
-
- }
-
-